// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
const cyclone = require("cyclone-parser")
window.addEventListener('DOMContentLoaded', () => {
  const replaceText = (selector, text) => {
    const element = document.getElementById(selector)
    if (element) element.innerText = JSON.stringify(new cyclone.CycloneParser().parse({ valueRaw: "let a = 1;", type: "program" }))
  }

  for (const type of [ 'electron']) {
    replaceText(`${type}-version`, process.versions[type])
  }
})
